package com.android.justcook;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import camp.android.justcook.R;

import com.android.justcook.sqlite.RecipesDataSource;
import com.android.justcook.tests.DataBaseTest;

public class MainActivity extends BaseListActivity {
	//Just dummy categories and pics. To be returned from DB in future!!!
	public final static String[] CATEGORIES = { "Vegetables", "Diary", "Chicken", "Pork","Deserts", "Android"};
	public final static int[] CATEGORY_IMAGES = { R.drawable.vegetables, R.drawable.diary,
		R.drawable.chicken, R.drawable.pork, R.drawable.desserts, R.drawable.android};
	public final static String[][] MEALS = { {"Potatoes", "Tomato salad", "Cucumber salad"} , {"Coccoa milk", "French cheese"}, 
			{"Roasted", "Running"}, {"Swine", "Steak"}, {"Pudding", "Cake", "Cookie"}, 
			{"Cupcake","Doughnut", "Eclair", "Froyo", "Gingerbread", "Honeycomb", 
			"Ice sandwich", "Jelly bean"}};
	public final static String[][] MEALS_POINTS = { {"50", "20", "30"} , {"10", "50"},
			{"25", "15"}, {"10", "75"}, {"35", "15", "45"}, 
			{"30","55", "20", "30", "20", "10", "20", "50"}};
	public final static String[][] MEALS_DESCRIPTIONS = { {"Just a wonderful dish, try it!", "Just a wonderful dish, try it!", "Just a wonderful dish, try it!"} , 
		{"Just a wonderful dish, try it!", "Just a wonderful dish, try it!"}, 
			{"Just a wonderful dish, try it!", "Just a wonderful dish, try it!"}, {"Swine", "Steak"}, {"Just a wonderful dish, try it!", "Just a wonderful dish, try it!", "Just a wonderful dish, try it!"}, 
			{"Just a cake to go with your coffee!","Just a policeman's everyday meal!", "Just yummmi! Not as hard as it seems to be prepared", 
			"Just frozen yoghurt - you gotta try it!", "Just a cookie... a man cookie!", "Just delicious and healthy honey from the bees nearby!", 
			"Just for the hot summer days!", "Just every flavour Bertie Botts"}};
	public final static int[][] MEALS_IMAGES={{R.drawable.def, R.drawable.def, R.drawable.def },
		{R.drawable.def, R.drawable.def},{R.drawable.def, R.drawable.def},{R.drawable.def, R.drawable.def},
		{R.drawable.def, R.drawable.def,R.drawable.def},{R.drawable.def, R.drawable.def,
			R.drawable.def, R.drawable.def,R.drawable.def, R.drawable.def,R.drawable.icecreamsandwich, R.drawable.def}};
	public final static String[][] MEALS_INGRIDIENTS={{"","",""},{"",""},{"",""},{"",""},{"","",""},
		{"","","","","","","* Bread \n* Butter \n* Ham \n* Cheese \n* Fridge",""}};
	public final static String[][] MEALS_METHOD={
		{"","","","","","","Take the sliced bread and but some butter on it. " +
				"Add some ham. " +
				"Place some cheese over the ham. " +
				"Finally put the second slice of bread on top. " +
				"Take the sandwich and put it in the freezer for half an hour. " +
				"Bon apeti!",""}};

	

    
	@Override
    public void onCreate(Bundle savedInstanceState) {
		getActionBar().setTitle("JustCook");        
		String[] categories = CATEGORIES;
		int[] images = CATEGORY_IMAGES;
		getActionBar().setTitle("JustCook");
        setContentView(R.layout.activity_main);
        ListAdapter adapter = new CategoryListAdapter(getLayoutInflater(), categories, images);
        getListView().setAdapter(adapter);
        
        DataBaseTest test = new DataBaseTest();
        test.fillDatabase(new RecipesDataSource(this));
        
        super.onCreate(savedInstanceState);
    }

   
    public final static String EXTRA_MESSAGE = "com.android.justcook.MESSAGE";
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
    	super.onListItemClick(l, v, position, id);
    	Intent intent = new Intent(this, RecipesListActivity.class);
    	intent.putExtra(EXTRA_MESSAGE, (int) id);
    	startActivity(intent);
    }
    
    
}
